<?php
/**
 * cache.inc.php
 */

if(!defined('IN_SITE') || !defined('IN_ADMIN')) {
	exit('Access Denied');
}

require_once SITE_ROOT.'include/cache.func.php';

if($dosubmit)
{
	if($type)
	{
		if($type['all']) updatecache();
		if($type['category']) updatecache('category');
		
		//if($type['hotarticle']) updatecache('hotarticle');
		//if($type['announcement']) updatecache('announcement');
		if($type['tpl'])
		{
			$tpl = dir(SITE_ROOT.'data/templates');
			while($entry = $tpl->read()) {
				if(preg_match("/\.php$/", $entry)) {
					@unlink(SITE_ROOT.'data/templates/'.$entry);
				}
			}
			$tpl->close();
		}
		showmessage("缓存更新完毕");
	}
	else
	{
		showmessage("未知操作。");
	}
}
else
{
	include admin_tpl("cache");
}
?>